package com.ssc.ssc.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class SysInterceptor {
	
	public boolean preHandle(HttpServletRequest request,
	                         HttpServletResponse response, Object handler) throws Exception {
		
		HttpSession session = request.getSession();
		Object user = session.getAttribute("AdminSession");
		System.out.println("===========拦截器==================");
		if (user == null) {
			request.getRequestDispatcher("/WEB-INF/jsp/login.jsp").forward(request, response);
			return false;
		}
		return true;
	}
}
